//
//  HMDrugStencilCell.swift
//  HealthMonitoring
//
//  Created by YTYanK on 02/04/2019.
//  Copyright © 2019 YTYanK. All rights reserved.
//

import UIKit
import SwiftyJSON

class HMDrugStencilCell: UITableViewCell {
    
    /// cell 高度
    var cellHeight: CGFloat = 0
    var head =  TitleHead()
    var sview = UIView()
    
    /// cell 回调
    var cellBlock: ((_ cell: HMDrugStencilCell) -> (HMDrugStencilCell))?
    
    class func initCell(dataType: DataType, json:(titleData:JSON, adviseData: JSON, drugsData: JSON), tableView: UITableView, indexPath: IndexPath) -> HMDrugStencilCell? {
        let idStr = "HMDrugStencilCell"
        var cell: HMDrugStencilCell? = tableView.dequeueReusableCell(withIdentifier: idStr) as? HMDrugStencilCell
        
        if cell == nil {
            cell = HMDrugStencilCell.init(style: .default, reuseIdentifier: idStr)
        }
        cell?.selectionStyle = UITableViewCellSelectionStyle.none
        cell?.initTitleView((cell?.contentView)!,titleData: json.titleData, indexPath)
       // cell?.initAdviseView((cell?.contentView)!,adviseData: json.adviseData, indexPath)
       // cell?.initDrugsView((cell?.contentView)!,drugsData: json.drugsData, indexPath)
        
        cell?.cellHeight = 100.0
        return cell
    }
    
    // 标题部分
    func initTitleView(_ cellView: UIView, titleData: JSON, _ indexPath: IndexPath) {
       let maatter = UIView.init(frame: CGRect.init(x: 0, y: 0, width: 199, height: 100))
        maatter.backgroundColor = .red
//        head = TitleHead(self, addView: maatter)
//        head.setJson(json: ["describe": "大大大大大"])
        cellView.addSubview(maatter)
        
    }
    // 生活建议部分
    func initAdviseView(_ cellView: UIView, adviseData: JSON, _ indexPath: IndexPath) {
        
    }
    // 药单部分
    func initDrugsView(_ cellView: UIView, drugsData: JSON, _ indexPath: IndexPath) {
        
    }
    
    
    func setupViews(_ dataType: DataType, _ json: JSON, _ tableView: UITableView, _ view: UIView, _ indexPath: IndexPath) {

//
//        self.cellHeight = 100.0
        
    }
    
    
    func updateJson(data: JSON) {
        
    }

}
